<?php

namespace App\Utils\Tools;

class Signature
{
    /**
     * 生成签名
     * @param $method
     * @param $apiPath
     * @param $params
     * @return string
     */
    public static function makeSignature($method, $apiPath, $params): string
    {
        $secretKey = 'ECH66idMWAMhteGBqiFIWAHf4yTuFDri';
        ksort($params);
        $stringToSign = 'method=' . strtolower($method) . '&path=' . $apiPath . '&' . urldecode(http_build_query($params));
        return md5(md5($stringToSign) . $secretKey);
    }
}
